﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.components.mainmenu {
    import reprise.ui.*;
    import flash.events.*;
    import reprise.events.*;
    import reprise.controls.*;

    public class ShopPlaceholderScrollItem extends SimpleButton {

        protected var m_bottomSlot:UIComponent;
        protected var m_topSlot:UIComponent;
        protected var m_topSlotIsFree:Boolean = true
        protected var m_bottomSlotIsFree:Boolean = true
        protected var m_topItem:UIComponent;
        protected var m_bottomItem:UIComponent;

        public static const EMPTY:String = "EMPTY";

        public function containsItem(_arg1:ShopItemDisplay):Boolean{
            return ((((this.m_topItem == _arg1)) || ((this.m_bottomItem == _arg1))));
        }
        public function hasTopFreeSlot():Boolean{
            return (this.m_topSlotIsFree);
        }
        public function hasBottomFreeSlot():Boolean{
            return (this.m_bottomSlotIsFree);
        }
        public function addItemToTopSlot(_arg1:ShopItemDisplay):void{
            this.m_topItem = UIComponent(this.m_topSlot.addChild(_arg1));
            _arg1.addEventListener(DisplayEvent.REMOVED_FROM_DOCUMENT, this.topItem_removed);
            this.m_topSlotIsFree = false;
        }
        public function addItemToBottomSlot(_arg1:ShopItemDisplay):void{
            this.m_bottomItem = UIComponent(this.m_bottomSlot.addChild(_arg1));
            _arg1.addEventListener(DisplayEvent.REMOVED_FROM_DOCUMENT, this.bottomItem_removed);
            this.m_bottomSlotIsFree = false;
        }
        override protected function initialize():void{
            addCSSClass("customizePlaceholderScrollItem");
            super.initialize();
        }
        override protected function createChildren():void{
            this.m_topSlot = addComponent("placeholderSlot");
            this.m_bottomSlot = addComponent("placeholderSlot");
            this.m_bottomSlot.addCSSClass("bottomSlot");
        }
        private function bottomItem_removed(_arg1:DisplayEvent):void{
            var _local2:ShopItemDisplay = ShopItemDisplay(_arg1.currentTarget);
            _local2.removeEventListener(DisplayEvent.REMOVED_FROM_DOCUMENT, this.bottomItem_removed);
            this.m_bottomSlotIsFree = true;
            this.m_bottomItem = null;
            this.checkState();
        }
        private function topItem_removed(_arg1:DisplayEvent):void{
            var _local2:ShopItemDisplay = ShopItemDisplay(_arg1.currentTarget);
            _local2.removeEventListener(DisplayEvent.REMOVED_FROM_DOCUMENT, this.topItem_removed);
            this.m_topSlotIsFree = true;
            this.m_topItem = null;
            this.checkState();
        }
        private function checkState():void{
            if (((this.m_topSlotIsFree) && (this.m_bottomSlotIsFree))){
                dispatchEvent(new Event(EMPTY));
            };
        }

    }
}//package net.wooga.pets.views.components.mainmenu 
